<script type="text/javascript">
$(function(){	
	bindSubmitHead_Head();
	$("#imgUpLoad_Head").bind("click",choiceHeadImg_Head);
	$("#fileHeadUpload_Head").bind("change",loadImgHead_Head);
});
function bindSubmitHead_Head(){	
	var options = {  
	        beforeSubmit:  showRequestHead_Head,  //提交前处理 
	        success:       showResponseHead_Head,  //处理完成 
	        resetForm: false,  
	        dataType:  'json'  
	    };  
	  
	    $('#formArchive_Head').submit(function() {
		    
	        $(this).ajaxSubmit(options);
	        return false;
	    });  
}
function showRequestHead_Head(formData, jqForm, options) { 
    return true;  
}  
  
function showResponseHead_Head(data, statusText)  {	
    if(data.ReturnCode==1){
        $("#imgHead_Head").attr("src",data.src);
        saveArchiveHead_Head(data.src);
    }else{
        SetError("spanImgTip_Head",data.Msg);
    }
    return false;   
} 
function saveArchiveHead_Head(src){
	var params = {headurl:src};
	$.ajax({
		type:"post",
		url:"index.php/login/saveArchiveHead",
		dataType:"json",
		data:params,
		success:function(data){
			
		}
	});
}
function choiceHeadImg_Head(){
	$("#fileHeadUpload_Head").trigger("click");
}
function loadImgHead_Head(){
	
	ClearError("spanImgTip_Head");
	var fileName = $("#fileHeadUpload_Head").val();
	var ext=fileName.substr(fileName.indexOf(".")).toLowerCase();
	if(ext!=".gif" && ext!=".jpg" && ext!=".jpeg" && ext!=".png" && ext!=""){
		SetError("spanImgTip_Head","图片格式无效");		
		return;
	}
	if(!IsEmpty(fileName)){	
		$("#formArchive_Head").submit();
		return;
	}
	
	
	if(IsEmpty(fileName))
		$("#imgHead_Head").attr("src","images/touxiang_img.jpg");
	else
		$("#imgHead_Head").attr("src",src);
}

$(function(){
	menuA();
});
//实现方法A
function menuA(){
	$('#menu>div>ul>li').hover(function(){
		$(this).children('a').toggleClass('sel');
		$(this).children('.hm').toggle();
	});
	$('#menu>div>ul>li>div').hover(function(){
		//$('#menu>div>ul>#bg').children('a').toggleClass('bg');
	});
}

</script>
<!-- 个人资料 开始 -->
<form id="formArchive_Head" action="index.php/login/uploadImg" method="post"
	enctype="multipart/form-data">
	<div class="vip">
		<div class="vip_zl">
			<div class="left">
				<img id="imgHead_Head"
					src="<?php if(empty($user['headurl'])) print 'images/vip_img.jpg'; else print $user['headurl']; ?>"
					width="154" height="154" /> <input type="file" id="fileHeadUpload_Head"
					name="mypic" style="display: none">
				<div class="ghtx">
					<img id="imgUpLoad_Head" class="link" src="images/ghtx_inp.jpg" />
				</div>
			</div>
			<div class=" vip_zl_k">
				<div class="vip_name heiti"><?php echo $user['realname'];?></div>
				<div class="vip_shenfen">身份认证</div>
				<div class="vip_ziliao">
					<a href="index.php/manage/marchive">修改资料</a>
				</div>
			</div>
			<div class=" vip_zl_k_x">
				<div class="vip_shengao"><?php echo $user['age'];?> 岁</div>
				<div class="vip_shengao"><?php echo $user['high'];?> CM</div>
			</div>
			<div class=" vip_zl_k">
				<div class="vip_dizhi"><?php echo $user['provincename'];?></div>
				<div class="vip_dizhi">
    <?php
				$type = $user ['modeltype'];
				$s = "";
				$type = trim ( $type, "/" );
				$arrType = explode ( "/", $type );
				foreach ( $arrType as $value ) {
					if ($value == "1")
						$s .= "平面/广告";
					else if ($value == "2")
						$s .= "T台走秀";
					else if ($value == "3")
						$s .= "车展/礼仪";
					else if ($value == "4")
						$s .= "局部/内衣";
					$s .= "&nbsp;";
				}
				echo $s;
				?>
    </div>
			</div>
		</div>

		<div class="vip_yq">
			<span><i>邀请好友注册：</i></span> <span>
				<div class="left">
					<input name="" type="text" style="width: 270px; height: 25px;" />
				</div>
				<div class="pl_10 right">
					<img name="" class="link" src="images/fzlj.jpg" />
				</div>
			</span> <span>一键分享到其他网站，邀请更多好友。</span> <span><img
				src="images/wl_img.jpg" /></span>
		</div>
	</div>
	<!-- 个人资料 结束 -->

	<!-- 后台菜单 开始 -->
	<div id="menu" class="caidan">
		<div class="caidan_dh">
			<ul>
				<li id="bg"><a href="javascript:void(0)">模特档案</a>
					<div class="hm">
						<a href="index.php/manage/userinfo">基本信息</a><a
							href="index.php/manage/marchive">模特档案</a><a
							href="index.php/manage/experience">模特经验</a>
					</div></li>
				<li><a href="index.php/manage/mcard">模特卡管理</a></li>
				<li><a href="index.php/manage/malbum">相册管理</a></li>
				<li><a href="javascript:void(0)">账户设置</a>
					<div class="hm">
						<a href="index.php/manage/midcard">身份认证</a><a
							href="index.php/manage/mweibo">同步绑定</a><a
							href="index.php/manage/mpwd">密码修改</a>
							<a href="index.php/manage/memailphone">手机邮箱绑定</a>
					</div></li>
			</ul>
			<div class="right pt_5">
				<a href="index.php/login/show">进入我的主页</a>
			</div>
		</div>
	</div>
</form>
<!-- 后台菜单 结束 -->
